<%@page import="com.grep.extra.dao.impl.TaskDAOSQL"%>
<%@page import="java.util.Iterator"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.grep.extra.factory.data.impl.TaskUrl,java.util.*,com.grep.web.manager.FenYe"%> 
<%
//回应ajax请求的数据，根据网站站点ID，显示该站点下所有任务内容
response.setCharacterEncoding("utf-8");  
String siteId = request.getParameter("siteid");
String index = request.getParameter("index");
String pagenum = request.getParameter("pagenum");

String responseText = "[";

int suoyin = Integer.parseInt(index);
int pagesize = Integer.parseInt(pagenum);

FenYe fenye = new FenYe();
List<TaskUrl> list = fenye.getTaskFenYeData(siteId, suoyin,pagesize); 

TaskDAOSQL taskDao = new TaskDAOSQL();

//得到任务数量
int count = taskDao.getTaskCount(siteId);

for(int i=0;i<list.size();i++){
	
	TaskUrl task = new TaskUrl();
	task = list.get(i);
	String taskid = task.getId();
	String taskname = task.getTaskName();
	String taskdesc = task.getTaskDesc();
	String Taskanalyse = task.getTaskAnalyse();
	String Taskpolicy = task.getTaskPolicy();
	if(i==list.size()-1){
		responseText +="{\"taskid\": \""+taskid+"\",\"taskname\": \""+taskname+"\",\"Taskanalyse\": \""+Taskanalyse+"\",\"Taskpolicy\": \""+Taskpolicy+"\",\"taskdesc\": \""+taskdesc+"\",\"count\": \""+count+"\"}";
	}else{
		responseText +="{\"taskid\": \""+taskid+"\",\"taskname\": \""+taskname+"\",\"Taskanalyse\": \""+Taskanalyse+"\",\"Taskpolicy\": \""+Taskpolicy+"\",\"taskdesc\": \""+taskdesc+"\"} , ";
	}
}
responseText += "]";
response.getWriter().println(responseText);




%>